<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

class OrderService extends Model
{
    use HasDateTimeFormatter;
    use SoftDeletes;

    protected $table = 'order_service';

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'order_id',
        'title',
        'history',
        'review_report',
        'syntax_report',
        'bibliometric_report',
        'journal_report',
        'cover_page',
        'contents_page',
        'full_report',
        'polish',
        'target_journal',
        'author_info',
        'submit_email',
        'submit_reg_info',
        'submit_detail',
        'replenish_info',
    ];

    protected $casts = [
        'history' => 'json',
        'target_journal' => 'json',
        'review_report' => 'json',
        'syntax_report' => 'json',
        'bibliometric_report' => 'json',
        'cover_page' => 'json',
        'contents_page' => 'json',
        'full_report' => 'json',
    ];

    public function order()
    {
        return $this->belongsTo(Order::class, 'id', 'order_id');
    }
}
